package com.neuedu.nep.service.impl;

import com.neuedu.nep.dao.SupervisorDao;
import com.neuedu.nep.dto.SignUpDTO;
import com.neuedu.nep.model.Supervisor;
import com.neuedu.nep.service.SupervisorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 黄宇佳
 * @create 2024-04-09 16:36
 * @description:
 */
@Service
public class SupervisorServiceImpl implements SupervisorService {
    @Resource
    private SupervisorDao supervisorDao;

    @Override
    public int SignUp(Supervisor supervisor) {
        Supervisor supervisor1 = supervisorDao.selectByPrimaryKey(supervisor.getTelId());
        if (supervisor1!=null){
            return -1;
        }else{
            int result = supervisorDao.insertSelective(supervisor);
            if (result>0){
                return 1;
            }else {
                return 0;
            }
        }
    }

    @Override
    public Supervisor SignIn(String Telid, String password) {
        Supervisor supervisor=supervisorDao.selectByPrimaryKey(Telid);
        if (supervisor.getPassword().equals(password)){
            return supervisor;
        }else{
            return null;
        }
    }
}
